﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Editor.QuestionInterface;
using Editor.Utilities;

namespace Editor.QuestionInterface
{
    public partial class AddInteractivePageForm : Form
    {
        private List<XmlAnything<HelperQuestion>> helperQuestions;
        public InteractivePage InteractivePage { get; set; }
       
        public string QuestionName
        {
            get
            {
                return textBoxName.Text;
            }
        }

        public AddInteractivePageForm()
        {
            InitializeComponent();
        }

        private void AddInteractivePageForm_Load(object sender, EventArgs e)
        {
            helperQuestions = new List<XmlAnything<HelperQuestion>>();
            InteractivePage = new InteractivePage();
        }

        private void buttonAdd_Click(object sender, EventArgs e)
        {
            InteractivePage.Name = textBoxName.Text;
            InteractivePage.MainQuestionText = textBoxQuestionText.Text;
            InteractivePage.Subject = textBoxSubject.Text;
            InteractivePage.Format = textBoxConvention.Text;
            InteractivePage.Answers = textBoxAnswer.Text;
            InteractivePage.CorrectAnswerDescription = textBoxCAns.Text;
            InteractivePage.IncorrectAnswerDescription = textBoxIAns.Text;
            InteractivePage.HelperQuestions = helperQuestions;
            InteractivePage.UpdateInnerControl();
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void buttonAddHint_Click(object sender, EventArgs e)
        {
            var ahqf = new AddHintQeustionForm();

            if (ahqf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                helperQuestions.Add(new XmlAnything<HelperQuestion>(ahqf.HelperQuestion));
            }
        }

        private void buttonEditVisual_Click(object sender, EventArgs e)
        {

        }
    }
}
